package map.beans;

public class ServerInfoBean {

	private String scheme;
	private String host;
	private int port;
	private String contextPath;

	public ServerInfoBean() {
		super();
	}

	public ServerInfoBean(String scheme, String host, int port, String contextPath) {
		super();
		this.scheme = scheme;
		this.host = host;
		this.port = port;
		this.contextPath = contextPath;
	}

	public String getScheme() {
		return scheme;
	}

	public void setScheme(String scheme) {
		this.scheme = scheme;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	public String getContextPath() {
		return contextPath;
	}

	public void setContextPath(String contextPath) {
		this.contextPath = contextPath;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();

		sb.append(this.scheme);
		sb.append("://");
		sb.append(this.host);
		sb.append(":");
		sb.append(this.port);
		if (this.contextPath.startsWith("/")) {
			sb.append(this.contextPath);
		} else {
			sb.append("/" + this.contextPath);
		}
		return sb.toString();
	}

}
